from flask import request, redirect, url_for, render_template, session


import sys
sys.path.append("..")
from models import UserMsg

def defineUserViews(app,db):

    @app.route('/user/profile')
    def profile():
        print(session['user'])
        id = session["user"]["id"]
        print("id是",id)
        userinfo = UserMsg.query.filter_by(id=id).first()
        return render_template('user/profile.html',userinfo=userinfo)

    @app.route('/user/user_list')
    def user_list():
        return render_template('user/user_list.html')

    @app.route('/user/contact_list')
    def contact_list():
        return render_template('user/contact_list.html')

    @app.route('/user/invoice')
    def invoice():
        return render_template('user/invoice.html')

    @app.route('/user/timeline')
    def timeline():
        return render_template('user/timeline.html')